package ltd.followkba.page;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import ltd.advskin.MRAM;
import ltd.advskin.MSKIN;
import ltd.advskin.base.BasePage;
import ltd.advskin.base.KcTypeListener;
import ltd.advskin.view.KcBtnProgress;
import ltd.advskin.view.KcBtnText;
import ltd.advskin.view.KcHeaderView;
import ltd.followkba.MAPP;
import ltd.followkba.R;
import ltd.followkba.task.BDbsAccount;
import ltd.followkba.task.LogTyp;
import ltd.followkba.task.RunUtils;
import main.MAPI;

import static ltd.advskin.MSKIN.MSTRING;
import static ltd.advskin.MSKIN.MTOAST;

public class StepLikePage extends BasePage {
    private EditText etStepTime;
    private KcBtnProgress kbtSaveSAtep;

    // 所有的页面都接受同样的方式打开LOG
    public static boolean logEnable;

    public void MLOG(String text) {
        if (logEnable) {
            MSTRING(MAPI.GET_LOG_NAME(this) + text);
        }
    }

    @Override
    public void onInitView() {                       // 使用者需要继承，初始化页面控件等显示
        setLayout(R.layout.page_step_like);
        mKcHeaderView = findViewById(R.id.khvStepLike);
        mKcHeaderView.setTitle("间隔时间及点赞设置", new KcTypeListener() {
            @Override
            public void onMessage(int type) {
                switch (type) {
                    case KcHeaderView.TYPE_CLICK_LEFT:
                        onFinish();
                        break;
                    case KcHeaderView.TYPE_CLICK_RIGHR:

                        break;
                }
            }
        });
        etStepTime = findViewById(R.id.etStepTime);
        kbtSaveSAtep = findViewById(R.id.kbtSaveSAtep);
        kbtSaveSAtep.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {                                               // 复制
                String text = etStepTime.getText().toString();          // etStepTime
                MAPP.mBDbsAccount.SetConfig[0] = MAPI.STRING_DEC32(text);        // [0]间隔时间设置
                MTOAST("已修改");
                RunUtils.saveBDbsAccount(MAPP.mBDbsAccount);
            }
        });

        MSKIN.setText(String.format("%s", MAPP.mBDbsAccount.SetConfig[0]), etStepTime);
    }
}
